

CREATE TABLE xml_info_201712 (
     done_code number NOT NULL,
     activity_way number NOT NULL,
     actioncode number NOT NULL,
     xml_data clob NULL
);


-- 普通存储过程
CREATE OR REPLACE FUNCTION add_numbers(a INT, b INT)
RETURNS INT AS $$
BEGIN
RETURN a + b;
END;
$$ LANGUAGE plpgsql;

-- 返回结果集的存储过程
CREATE OR REPLACE FUNCTION setoffunc(i int, out result_1 bigint, out result_2 bigint)
   returns SETOF RECORD
   as $$
begin
       result_1 = i + 1;
       result_2 = i * 10;
   return next;
end;
   $$language plpgsql;

-- 游标出参的存储过程
CREATE OR REPLACE FUNCTION refcursorfunc() RETURNS refcursor AS $$  DECLARE  mycurs refcursor;
BEGIN
OPEN mycurs FOR SELECT 1 UNION SELECT 2;
RETURN mycurs;
END;
    $$language plpgsql;
